package com.victualler.core.common.enums;

/**
 * @Aouthor Guoshichang
 * @Date 16:40 on 2018/7/20.
 * @Function 导出类型的枚举类
 */
public enum JasperTypeEnum {
    PDF("pdf","application/pdf"),
    EXCEL_XLS("xls","application/msexcel"),
    EXCEL_XLSX("xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),
    WORD_DOC("doc","application/msword"),
    WORD_DOCX("docx","application/vnd.ms-word.document.12"),
    HTML("html","text/html");


    private String key;
    private String contentType;

    private JasperTypeEnum(String key, String contentType) {
        this.key = key;
        this.contentType = contentType;
    }

    public String getKey() {
        return key;
    }

    public String getContentType() {
        return contentType;
    }

    public static String getContentType(String key) {
        JasperTypeEnum[] vrr = values();
        for (int i = 0; i < vrr.length; i++) {
            JasperTypeEnum e = vrr[i];
            if (e.getKey().equals(key)) {
                return e.contentType;
            }
        }
        return null;
    }



}
